package com.demo.nio.Selector;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;

public class Client {

    public static void main(String[] args) {
        try (SocketChannel sc = SocketChannel.open()) {
            sc.connect(new InetSocketAddress("localhost",8080));
            ByteBuffer buffer = StandardCharsets.UTF_8.encode("hello from a client");
            sc.write(buffer);
        } catch (IOException e) {
        }
    }
}
